package cn.jzq.kotoba.common.listener;

import cn.hutool.core.date.DateUtil;
import cn.jzq.kotoba.common.consts.MqQueueConst;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * log mq 消息处理类
 * @author jzq
 * @date 2018-09-10
 */
@Component
@RabbitListener(queues = MqQueueConst.LOG_QUEUE)
public class LogReceiveListener {

    @RabbitHandler
    public void receive(String msg) throws InterruptedException {
        System.out.println("receive: " + msg + DateUtil.now());
        Thread.sleep(3000);
        System.out.println("handle done: " + DateUtil.now());
    }
}
